package com.sxzjrj.config

import java.util.Properties

import com.typesafe.config.{Config, ConfigFactory}
import org.apache.kafka.common.serialization.StringDeserializer

/**
  * Created by ljj in 2019/3/23
  *
  */
object MBYLBCConfig {

  private lazy val config: Config = ConfigFactory.load()

  val srcPath: String = config.getString("srcPath")

  val descPath = config.getString("descPath")

  val driver = config.getString("db.default.driver")
  val user = config.getString("db.default.user")
  val password = config.getString("db.default.password")
  val url = config.getString("db.default.url")

  val properties = new Properties()
  properties.setProperty("user", user)
  properties.setProperty("driver", driver)
  properties.setProperty("password", password)
  properties.setProperty("url", url)

  val topic = config.getString("mbylbc.topics")
  val brokers = config.getString("mbylbc.brokers")
  val groupId = config.getString("mbylbc.groupId")

  val kafkaParams = Map[String, Object](
    "bootstrap.servers" -> brokers,
    "key.deserializer" -> classOf[StringDeserializer],
    "value.deserializer" -> classOf[StringDeserializer],
    "group.id" -> groupId,
    "auto.offset.reset" -> "earliest",
    "enable.auto.commit" -> (false: java.lang.Boolean)
  )


}
